@ECHO OFF
prompt $p$q$q$g
REM THIS A BATCH FILE TO DEBUG FORTRAN PROGRAM.
REM IT IS USED OF EDITTING,COMPILING,LINKING AND RUNNING FORTRAN PROGRAM.
REM BACKUP .FOR FILES
IF EXIST %4.FOR COPY %3.FOR+%4.FOR %3.FOR
IF EXIST %5.FOR COPY %3.FOR+%5.FOR %3.FOR
IF EXIST %6.FOR COPY %3.FOR+%6.FOR %3.FOR
IF EXIST %7.FOR COPY %3.FOR+%7.FOR %3.FOR
IF EXIST %8.FOR COPY %3.FOR+%8.FOR %3.FOR
IF EXIST %9.FOR COPY %3.FOR+%9.FOR %3.FOR
:LOOP
IF %1.FOR==NONAME.FOR  GOTO NOMAIN
IF NOT EXIST %1.FOR GOTO NOMAIN2
:NOMAINEND
IF %2.FOR==.FOR GOTO 1
IF NOT EXIST %2.FOR H42
:1
IF %3.FOR==.FOR GOTO 2
IF NOT EXIST %3.FOR H43
:2
:TOCENTER
IF EXIST *.SGN DEL *.SGN
frcandan
CLS
IF EXIST EDMAINFO.SGN GOTO MAINFO
IF EXIST EDSECOFO.SGN GOTO SECOFO
IF EXIST EDTHIRFO.SGN GOTO THIRFO
IF EXIST FRMAINFO.SGN GOTO FR1
IF EXIST FRSECOFO.SGN GOTO FR2
IF EXIST FRTHIRFO.SGN GOTO FR3
IF EXIST LKALLOBJ.SGN GOTO LAO
IF EXIST COMALLFI.SGN GOTO LR
IF EXIST COLINRUN.SGN GOTO LR
IF EXIST LPRALFOR.SGN GOTO LPR0
IF EXIST LPRMNFOR.SGN GOTO LPR1
IF EXIST LPRA2FOR.SGN GOTO LPR2
IF EXIST LPRA3FOR.SGN GOTO LPR3
IF EXIST DERECRUN.SGN GOTO TORUN
IF EXIST QUITTBAT.SGN GOTO ENDBAT
GOTO TOCENTER
:LPR0
IF EXIST %1.FOR COPY %1.FOR LPT1
IF EXIST %2.FOR COPY %2.FOR LPT1
IF EXIST %3.FOR COPY %3.FOR LPT1
GOTO TOCENTER
:LPR1
IF EXIST %1.FOR COPY %1.FOR LPT1
IF NOT EXIST %1.FOR H41
GOTO TOCENTER
:LPR2
IF EXIST %2.FOR COPY %2.FOR LPT1
IF NOT EXIST %2.FOR H42
GOTO TOCENTER
:LPR3
IF EXIST %3.FOR COPY %3.FOR LPT1
IF NOT EXIST %3.FOR H43
GOTO TOCENTER
:MAINFO
IF EXIST %1.FOR GOTO MAINFO1
IF NOT EXIST %1.FOR GOTO MAINFO2
GOTO TOCENTER
     :MAINFO1
     COPY %1.FOR %1.FBK
	edit %1.FOR
	GOTO TOCENTER
	:MAINFO2
	H41
	edit %1.FOR
	GOTO TOCENTER
GOTO TOCENTER
:SECOFO
IF EXIST %2.FOR GOTO SECOFO0
IF %2.FOR==.FOR GOTO SECOFO1
IF NOT EXIST %2.FOR GOTO SECOFO2
GOTO TOCENTER
	:SECOFO0
     COPY %2.FOR %2.FBK
	edit %2.FOR
	GOTO TOCENTER
	:SECOFO1
     H82
	GOTO TOCENTER
	:SECOFO2
	H42
	edit %2.FOR
	GOTO TOCENTER
:THIRFO
IF EXIST %3.FOR GOTO THIRFO0
IF %3.FOR==.FOR GOTO THIRFO1
IF NOT EXIST %3.FOR GOTO THIRFO2
GOTO TOCENTER
	:THIRFO0
      COPY %3.FOR %3.FBK
	edit %3.FOR
	GOTO TOCENTER
	:THIRFO1
H83
	GOTO TOCENTER
	:THIRFO2
	H43
	edit %3.FOR
	GOTO TOCENTER
:FR1
IF EXIST %1.FOR GOTO FR11
H720
PAUSE
GOTO TOCENTER
	:FR11
	FOR1 %1.FOR;
	PAS2
	ECHO THIS FILE HAS BEEN COMPILED.
	PAUSE
	GOTO TOCENTER
:FR2
IF EXIST %2.FOR GOTO FR22
H722
GOTO TOCENTER
	:FR22
	FOR1 %2.FOR;
	PAS2
	ECHO THIS FILE HAS BEEN COMPILED.
	PAUSE
	GOTO TOCENTER
:FR3
IF EXIST %3.FOR GOTO FR33
H723
GOTO TOCENTER
	:FR33
	FOR1 %3.FOR;
	PAS2
	ECHO THIS FILE HAS BEEN COMPILED.
	PAUSE
	GOTO TOCENTER
:LAO
MAKELINK
ECHO ALL ARE LINKED.
PAUSE
GOTO TOCENTER
:LR
IF EXIST %1.FOR GOTO BIANYI1
      :BIANYI1END
IF %2.FOR==.FOR GOTO BIANYI3END
IF EXIST %2.FOR GOTO BIANYI2
      :BIANYI2END
IF %3.FOR==.FOR GOTO BIANYI3END
IF EXIST %3.FOR GOTO BIANYI3
      :BIANYI3END
ECHO COMPILE OVER.
 PAUSE
IF EXIST COMALLFI.SGN GOTO TOCENTER
IF EXIST COLINRUN.SGN GOTO TOLINK

	       :BIANYI1
REM             H11
		FOR1 %1.FOR;
		PAS2
		GOTO BIANYI1END
		:BIANYI2
REM             H12
		FOR1 %2.FOR;
		PAS2
		GOTO BIANYI2END
		:BIANYI3
REM             H13
		FOR1 %3.FOR;
		PAS2
		GOTO BIANYI3END
		:TOLINK
		MAKELINK
		ECHO LINK OVER.
 PAUSE
		:TORUN
		MAKERUNN
	      GOTO TOCENTER
:NOMAIN2
H41
RENAME %1.FOR FRFIRONE.FOR
GOTO NOMAINEND
:NOMAIN
H71
GOTO NOMAINEND
:ENDBAT
